package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wx
 * Date: 2023-08-15
 * Time: 23:10
 */
public class Comp {
    public void powerOn () {
        System.out.println("打开电脑");

    }
    public void poweroff () {
        System.out.println("关闭电脑");

    }

    public void useservice (USB usb) {
        usb.openDevice();
        usb.closeDevice();

        if(usb instanceof MOUSE) {
            MOUSE mouse = (MOUSE) usb;
            mouse.click();
        }else if(usb instanceof Keyboard)
        {
            Keyboard keyboard = (Keyboard) usb;
            keyboard.input();
        }

        usb.closeDevice();

    }
}
